package com.ttai.presenter.activity;

import android.widget.Toast;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.ttai.model.net.BuildTime;
import com.ttai.model.net.ResponseInfo;
import com.ttai.presenter.base.BasePresenter;
import com.ttai.ui.activity.EnterPage;

import retrofit2.Call;

public class EnterPagePresenter extends BasePresenter {
    EnterPage enterPage;
    public BuildTime buildTime;

    public EnterPagePresenter(EnterPage enterPage) {
        this.enterPage = enterPage;
    }


    @Override
    protected void showError(String message) {
        Toast.makeText(enterPage,message,Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void parseJson(JsonObject json) {
        Toast.makeText(enterPage,"发送成功",Toast.LENGTH_SHORT).show();
        Gson gson = new Gson();
        buildTime = gson.fromJson(json,BuildTime.class);
    }

    public void getVerifyCode(String phone,String way){
        Call<ResponseInfo> codeInfo = responseInfoApi.verifyCode(phone,way);
        codeInfo.enqueue(new CallBackAdapter());
    }
}
